import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import Test from './Test'

export default class App extends Component {
  state = {
    bBar: true,
  }
  render() {
    return (
      <div>
        App
        <button onClick={() => this.setState({ bBar: !this.state.bBar })}>
          卸载 Test
        </button>
        <button
          onClick={() => {
            ReactDOM.unmountComponentAtNode(document.getElementById('root'))
          }}
        >
          另一种触发卸载的方式
        </button>
        <hr />
        {this.state.bBar && <Test />}
      </div>
    )
  }
}
